<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
         var str = prompt("输入一组数，用空格分隔");
         var b = str.split(" ");
         var a = [];
          for (var i in b)
         a[i] = parseInt(b[i]);
          for (var i = 0; i < a.length - 1; i++) {
          for (var j = i + 1; j < a.length; j++) {
         if (a[i] > a[j]) {
         var c;
         c = a[i];
         a[i] = a[j]; console.log(a[i]);
         a[j] = c;
         }
         }
          }
         for (var i in a) {
         document.write(a[i] + " ");
         }
        </script>
</head>
<body>
    
</body>
</html>